package com.keyingbo.leran.pattern.factorypattern.simplefactory;

import com.keyingbo.leran.pattern.factorypattern.Aodi;
import com.keyingbo.leran.pattern.factorypattern.Baoma;
import com.keyingbo.leran.pattern.factorypattern.Benchi;
import com.keyingbo.leran.pattern.factorypattern.Cat;

/**
 * 简单工厂
 */
public class CatSimpleFactory {
    public static Cat createByName(String name){
        if ( "奔驰".equals(name) ){
            return new Benchi();
        } else if ("宝马".equals(name)){
            return new Baoma();
        } else if ("奥迪".equals(name)){
            return  new Aodi();
        }
        return  null;
    }
}
